package com.bhy702.generator.builder.factory;

import com.bhy702.generator.builder.factory.codeImpl.*;
import org.springframework.stereotype.Component;

/**
 * @author: brbai
 * @create: 2019-12-14 19:14:42
 * @description: code工厂
 */
@Component
public class CodeFactory {

    public Code getCodeInstance(String codeType){
        if(codeType == null){
            return null;
        }
        if(codeType.equalsIgnoreCase("CONTROLLER")){
            return new Controller();
        } else if(codeType.equalsIgnoreCase("SERVICE")){
            return new Service();
        } else if(codeType.equalsIgnoreCase("ENTITY")){
            return new Entity();
        } else if(codeType.equalsIgnoreCase("MAPPER")){
            return new Mapper();
        } else if(codeType.equalsIgnoreCase("MAPPER_XML")){
            return new MapperXml();
        }
        return null;
    }

}
